﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentValidation;

namespace Microhard.Permission.Validator
{
    public class LogonValidator : AbstractValidator<Microhard.Permission.Models.Logon>
    {
        public LogonValidator()
        {
            RuleSet("Login", () =>
            {
                RuleFor(u => u.UserName).NotEmpty().WithMessage(MsgForPermission.NeedUserName);
                RuleFor(u => u.UserName).Length(1, 10).WithMessage(MsgForPermission.MaxLenOfUserName);
                RuleFor(u => u.Password).NotEmpty().WithMessage(MsgForPermission.NeedPWD);
                RuleFor(u => u.Password).Length(6, 20).WithMessage(MsgForPermission.PWDLength);
            });
        }
    }
}
